/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.sais.eswn.ui;

import java.awt.event.ActionListener;
import java.util.Vector;
import javax.swing.Timer;

/**
 *
 * @author Romulus
 */
public class SwingUpdater extends Timer {
  private ActionListener parent;
  private Vector<UpdateTask> cQueue = new Vector<UpdateTask>();
  
  SwingUpdater(ActionListener parent) {
    super(20, parent);
    this.parent = parent;
    setInitialDelay(0);
    setCoalesce(true);
    start();
  }
  
  void add(UpdateTask task) {
    cQueue.add(task);
  }
  
  public UpdateTask pop() {
    return cQueue.size() > 0 ? cQueue.remove(0) : null;
  }
  
}
